# 定义

t1 = (1, 2, 3)
print(t1, type(t1))

t2 = tuple("abcdaa")
print(t2, type(t1))


t3 = ("张三", )
print(t3, type(t3))

# 一旦定义就不能更改
# 查询

print(t2[2])


# 相加

t4 = t1 + t2        # t1、t2 本身没有发生变化
print(t4)

print("a有多少个：", t4.count("a"))


# 生成器推导式

tup = (x for x in range(10) if x % 2 ==0)
print(tup, type(tup))

for i in tup:
    print(i)        # 实时计算偶数

